import 'package:fate_blind_box/ui/Home/activity/act_list_model.dart';
import 'package:fate_blind_box/utils/common_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../../theme/theme_color.dart';

class ActDetailsPrePage extends StatelessWidget {
  FuturePopular? itemModel;

  ActDetailsPrePage({Key? key, this.itemModel}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    itemModel ??= FuturePopular();
    String coverUrl = itemModel?.actiCover ?? '';
    String cityName=itemModel?.actiCity??'';
    if(itemModel?.actiProvince!=itemModel?.actiCity){
      cityName='${itemModel?.actiProvince}${itemModel?.actiCity}';
    }

    return AppWidget.navTitleBar(
      title: '预览',
      childWidget: Stack(
        children: [
          Column(
            children: [
              coverUrl.isEmpty
                  ? Container(
                      width: 1.sw,
                      height: 205.w,
                      color: Colors.grey,
                    )
                  : Container(
                      width: 1.sw,
                      height: 205.w,
                      decoration: BoxDecoration(
                        image: DecorationImage(
                          fit: BoxFit.cover,
                          image: AppWidget.getProviderImgView(coverUrl),
                        ),
                      ),
                    ),
              SizedBox(
                height: 136.w,
              ),
            ],
          ),
          Positioned(
              left: 14,
              right: 14,
              top: 146 + ScreenUtil().statusBarHeight,
              child: Container(
                padding: const EdgeInsets.only(left: 14, top: 14, bottom: 16),
                decoration: BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.circular(5),
                  boxShadow: const [
                    BoxShadow(
                        color: Color.fromRGBO(0, 0, 0, 0.1),
                        blurRadius: 10,
                        blurStyle: BlurStyle.outer,
                        offset: Offset(0, 2))
                  ],
                ),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(
                      itemModel?.actiTitle ?? '',
                      style: TextStyle(
                          fontSize: 16, color: ThemeColor.black3D3D3DColor),
                    ),
                    const SizedBox(
                      height: 14,
                    ),
                    Row(
                      children: [
                        Image.asset(
                          'images/scan/details_time_clock.png',
                          width: 14,
                        ),
                        const SizedBox(
                          width: 2,
                        ),
                        Text(
                          itemModel?.actiTime ?? '',
                          style: TextStyle(
                              color: ThemeColor.gray99A3B4Color, fontSize: 14),
                        )
                      ],
                    ),
                    const SizedBox(
                      height: 14,
                    ),
                    Row(
                      mainAxisSize: MainAxisSize.min,
                      children: [
                        Image.asset(
                          'images/scan/details_map_location.png',
                          width: 14,
                        ),
                        const SizedBox(
                          width: 2,
                        ),
                        Expanded(
                          child: Text(
                            '$cityName${itemModel?.actiArea}${itemModel?.actiAddr}',
                            style: TextStyle(
                                color: ThemeColor.gray99A3B4Color,
                                fontSize: 14,
                                overflow: TextOverflow.ellipsis),
                          ),
                        ),
                      ],
                    ),
                    const SizedBox(
                      height: 14,
                    ),
                    Row(
                      children: [
                        Image.asset(
                          'images/scan/deails_money_type.png',
                          width: 14,
                        ),
                        const SizedBox(
                          width: 2,
                        ),
                        Text(
                          itemModel?.actiCost ?? '',
                          style: TextStyle(
                              color: ThemeColor.redE84D46Color, fontSize: 14),
                        ),
                      ],
                    ),
                  ],
                ),
              ))
        ],
      ),
    );
  }
}
